﻿using System;
using System.Collections.Generic;
using System.Text;

namespace FieldDevice
{
    public class PowerQueue : List<PowerQueue.PowerItem>
    {
        public PowerQueue()
        {

        }
        public PowerItem RecordPowerItem(DateTime time, float pp, float qp, float pf, byte[] request, byte[] response)
        {
            PowerItem items = new PowerItem();
            items.Time = time;
            items.PP = pp;
            items.QP = qp;
            items.PF = pf;
            items.Request = request;
            items.Response = response;
            this.Add(items);
            int MaxPowerItem = 100;
            if (this.Count > MaxPowerItem)
            {
                for (int i = 0; i < 10;i++ )
                    this.RemoveAt(0);
            }
            return items;

        }

        public class PowerItem
        {
            public DateTime Time;
            public TimeSpan TimeSpan;
            public float PP;    //有功电能读数
            public float QP;    //无功电能读数
            public float PF;    //功率因素
            public float PComsuption;
            public float QComsuption;
            public float TotalComsuption;
            public byte[] Request;
            public byte[] Response;
            public PowerItem()
            {

            }
        }

    }
}
